home *** CD-ROM | disk | FTP | other *** search
- 0 rem << cd26-2 >>
- 1 rem commodare #22-2 :
- 2 rem simple comparison
- 3 rem solutions by
- 4 rem norm green (lines 100-130)
- 5 rem frank smith (lines 200-250)
- 6 rem & dennis furman (lines 300-350)
- 7 rem
- 10 data 1,2,3,4,5,6,7,8,9,10
- 20 data 10,9,8,7,6,5,4,3,2,2
- 30 for n=1 to 10 : read a(n) : next
- 40 for n=1 to 10 : read b(n) : next
- 50 ct=ct+1
- 60 on ct gosub 100,200,300
- 70 if ct<3 then 50
- 80 end
- 99 rem=================================
- 100 for n=1 to 10:xa=xa+a(n):ya=ya*a(n)
- 110 xb=xb+b(n) : yb=yb*b(n) : next
- 120 if xa=xb and ya=yb then print : print"match" : return
- 130 print"not a match" : return
- 199 rem================================
- 200 for c=1 to 10:for d=c to 10:ifa(c)<>b(d) then 220
- 210 h=b(c):b(c)=b(d):b(d)=h:goto 240
- 220 next d
- 230 print"the two sets are not the same":return
- 240 next c
- 250 print"the two sets contain the same numbers":return
- 299 rem================================
- 300 for i=1 to 10:forj=10 to i+1 step-1
- 310 if a(j)>a(j-1)thenc=a(j-1):a(j-1)=a(j):a(j)=c
- 320 if b(j)>b(j-1)thend=b(j-1):b(j-1)=b(j):b(j)=d
- 330 next j
- 340 ifa(i)<>b(i)then print"not equal":return
- 350 next i : print"equal":return
-